#include <iostream>
#include <vector>
#include <cstdio>

using namespace std;

int main()
{
    int N, T, idx = 0;
    int V = 20000;
    const int MAX = 0x3f3f3f3f;
    while (scanf("%d %d", &N, &T), N + T)
    {
        vector<int> val(N);
        vector<int> cnt(N);
        for (int i = 0; i < N; i++)
            cin >> val[i];
        for (int i = 0; i < N; i++)
            cin >> cnt[i];
        vector<int> dp(V + 1, MAX);
        dp[0] = 0;
        for (int i = 0; i < N; i++)
        {
            int M = cnt[i];
            if (val[i] * M >= V)
            {
                for (int v = val[i]; v <= V; v++) // complete pack
                    dp[v] = min(dp[v], dp[v - val[i]] + 1);
                continue;
            }
            int k = 1;
            while (k < M)
            {
                for (int v = V; v >= k * val[i]; v--) // 01 pack
                    dp[v] = min(dp[v], dp[v - k * val[i]] + k);
                M -= k;
                k *= 2;
            }
            for (int v = V; v >= M * val[i]; v--)// 01 pack
                dp[v] = min(dp[v], dp[v - M * val[i]] + M);
        }
        vector<int> dp2(V - T + 1, MAX);
        dp2[0] = 0;
        for (int i = 0; i < N; i++)
            for (int v = val[i]; v <= V - T; v++)
                dp2[v] = min(dp2[v], dp2[v - val[i]] + 1);

        int ans = MAX;
        for(int i=T;i<= V;i++)
            ans = min(ans, dp[i] + dp2[i-T]);
        if (ans == MAX)
            ans = -1;
        printf("Case %d: %d\n", ++idx, ans);
    }

    return 0;
}